import request from '@/utils/request'

import axios from '../js_sdk/xtshadow-axios/axios.min'

// 公共方法-创建接口调用方法
export function generateRequestFn(urlDict) {
	const api = {}
	for (const key in urlDict) {
		api[key] = function(params, data) {
			if (urlDict[key].methods && urlDict[key].methods === 'GET') {
				return axios.get(urlDict[key].url, {params: params})
			} else {
				return axios.post(urlDict[key], params, {
					params
				})
			}
		}
	}
	return api
}